package com.xt.base.dao.hibernate;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.transform.ResultTransformer;
import org.hibernate.type.Type;

public class ReadOnlyQueryImpl implements Query{

	protected Query query;
	
	public ReadOnlyQueryImpl(Query q){
		this.query = q;
	}
	
	public String[] getNamedParameters() throws HibernateException {
		return query.getNamedParameters();
	}

	public String getQueryString() {
		return query.getQueryString();
	}

	public String[] getReturnAliases() throws HibernateException {
		return query.getReturnAliases();
	}

	public Type[] getReturnTypes() throws HibernateException {
		return query.getReturnTypes();
	}

	@SuppressWarnings("unchecked")
	public Iterator iterate() throws HibernateException {
		return query.iterate();
	}

	@SuppressWarnings("unchecked")
	public List list() throws HibernateException {
		return query.list();
	}

	public ScrollableResults scroll() throws HibernateException {
		return query.scroll();
	}

	public ScrollableResults scroll(ScrollMode arg0) throws HibernateException {
		return query.scroll(arg0);
	}

	public Query setBigDecimal(int arg0, BigDecimal arg1) {
		query = query.setBigDecimal(arg0, arg1);
		return this;
	}

	public Query setBigDecimal(String arg0, BigDecimal arg1) {
		query = query.setBigDecimal(arg0, arg1);
		return this;
	}

	public Query setBigInteger(int arg0, BigInteger arg1) {
		query = query.setBigInteger(arg0, arg1);
		return this;
	}

	public Query setBigInteger(String arg0, BigInteger arg1) {
		query = query.setBigInteger(arg0, arg1);
		return this;
	}

	public Query setBinary(int arg0, byte[] arg1) {
		query = query.setBinary(arg0, arg1);
		return this;
	}

	public Query setBinary(String arg0, byte[] arg1) {
		query = query.setBinary(arg0, arg1);
		return this;
	}

	public Query setBoolean(int arg0, boolean arg1) {
		query = query.setBoolean(arg0, arg1);
		return this;
	}

	public Query setBoolean(String arg0, boolean arg1) {
		query = query.setBoolean(arg0, arg1);
		return this;
	}

	public Query setByte(int arg0, byte arg1) {
		query = query.setByte(arg0, arg1);
		return this;
	}

	public Query setByte(String arg0, byte arg1) {
		query = query.setByte(arg0, arg1);
		return this;
	}

	public Query setCacheMode(CacheMode arg0) {
		query = query.setCacheMode(arg0);
		return this;
	}

	public Query setCacheRegion(String arg0) {
		query = query.setCacheRegion(arg0);
		return this;
	}

	public Query setCacheable(boolean arg0) {
		query = query.setCacheable(arg0);
		return this;
	}

	public Query setCalendar(int arg0, Calendar arg1) {
		query = query.setCalendar(arg0, arg1);
		return this;
	}

	public Query setCalendar(String arg0, Calendar arg1) {
		query = query.setCalendar(arg0, arg1);
		return this;
	}

	public Query setCalendarDate(int arg0, Calendar arg1) {
		query = query.setCalendarDate(arg0, arg1);
		return this;
	}

	public Query setCalendarDate(String arg0, Calendar arg1) {
		query = query.setCalendarDate(arg0, arg1);
		return this;
	}

	public Query setCharacter(int arg0, char arg1) {
		query = query.setCharacter(arg0, arg1);
		return this;
	}

	public Query setCharacter(String arg0, char arg1) {
		query = query.setCharacter(arg0, arg1);
		return this;
	}

	public Query setComment(String arg0) {
		query = query.setComment(arg0);
		return this;
	}

	public Query setDate(int arg0, Date arg1) {
		query = query.setDate(arg0, arg1);
		return this;
	}

	public Query setDate(String arg0, Date arg1) {
		query = query.setDate(arg0, arg1);
		return this;
	}

	public Query setDouble(int arg0, double arg1) {
		query = query.setDouble(arg0, arg1);
		return this;
	}

	public Query setDouble(String arg0, double arg1) {
		query = query.setDouble(arg0, arg1);
		return this;
	}

	public Query setEntity(int arg0, Object arg1) {
		query = query.setEntity(arg0, arg1);
		return this;
	}

	public Query setEntity(String arg0, Object arg1) {
		query = query.setEntity(arg0, arg1);
		return this;
	}

	public Query setFetchSize(int arg0) {
		query = query.setFetchSize(arg0);
		return this;
	}

	public Query setFirstResult(int arg0) {
		query = query.setFirstResult(arg0);
		return this;
	}

	public Query setFloat(int arg0, float arg1) {
		query = query.setFloat(arg0, arg1);
		return this;
	}

	public Query setFloat(String arg0, float arg1) {
		query = query.setFloat(arg0, arg1);
		return this;
	}

	public Query setFlushMode(FlushMode arg0) {
		query = query.setFlushMode(arg0);
		return this;
	}

	public Query setInteger(int arg0, int arg1) {
		query = query.setInteger(arg0, arg1);
		return this;
	}

	public Query setInteger(String arg0, int arg1) {
		query = query.setInteger(arg0, arg1);
		return this;
	}

	public Query setLocale(int arg0, Locale arg1) {
		query = query.setLocale(arg0, arg1);
		return this;
	}

	public Query setLocale(String arg0, Locale arg1) {
		query = query.setLocale(arg0, arg1);
		return this;
	}

	public Query setLockMode(String arg0, LockMode arg1) {
		query = query.setLockMode(arg0, arg1);
		return this;
	}

	public Query setLong(int arg0, long arg1) {
		query = query.setLong(arg0, arg1);
		return this;
	}

	public Query setLong(String arg0, long arg1) {
		query = query.setLong(arg0, arg1);
		return this;
	}

	public Query setMaxResults(int arg0) {
		query = query.setMaxResults(arg0);
		return this;
	}

	public Query setParameter(int arg0, Object arg1) throws HibernateException {
		query = query.setParameter(arg0, arg1);
		return this;
	}

	public Query setParameter(String arg0, Object arg1) throws HibernateException {
		query = query.setParameter(arg0, arg1);
		return this;
	}

	public Query setParameter(int arg0, Object arg1, Type arg2) {
		query = query.setParameter(arg0, arg1,arg2);
		return this;
	}

	public Query setParameter(String arg0, Object arg1, Type arg2) {
		query = query.setParameter(arg0, arg1,arg2);
		return this;
	}

	@SuppressWarnings("unchecked")
	public Query setParameterList(String arg0, Collection arg1) throws HibernateException {
		query = query.setParameterList(arg0, arg1);
		return this;
	}

	public Query setParameterList(String arg0, Object[] arg1) throws HibernateException {
		query = query.setParameterList(arg0, arg1);
		return this;
	}

	@SuppressWarnings("unchecked")
	public Query setParameterList(String arg0, Collection arg1, Type arg2) throws HibernateException {
		query = query.setParameterList(arg0, arg1,arg2);
		return this;
	}

	public Query setParameterList(String arg0, Object[] arg1, Type arg2) throws HibernateException {
		query = query.setParameterList(arg0, arg1,arg2);
		return this;
	}

	public Query setParameters(Object[] arg0, Type[] arg1) throws HibernateException {
		query = query.setParameters(arg0, arg1);
		return this;
	}

	public Query setProperties(Object arg0) throws HibernateException {
		query = query.setProperties(arg0);
		return this;
	}

	public Query setReadOnly(boolean arg0) {
		query = query.setReadOnly(true);
		return this;
	}

	public Query setSerializable(int arg0, Serializable arg1) {
		query = query.setSerializable(arg0, arg1);
		return this;
	}

	public Query setSerializable(String arg0, Serializable arg1) {
		query = query.setSerializable(arg0, arg1);
		return this;
	}

	public Query setShort(int arg0, short arg1) {
		query = query.setShort(arg0, arg1);
		return this;
	}

	public Query setShort(String arg0, short arg1) {
		query = query.setShort(arg0, arg1);
		return this;
	}

	public Query setString(int arg0, String arg1) {
		query = query.setString(arg0, arg1);
		return this;
	}

	public Query setString(String arg0, String arg1) {
		query = query.setString(arg0, arg1);
		return this;
	}

	public Query setText(int arg0, String arg1) {
		query = query.setText(arg0, arg1);
		return this;
	}

	public Query setText(String arg0, String arg1) {
		query = query.setText(arg0, arg1);
		return this;
	}

	public Query setTime(int arg0, Date arg1) {
		query = query.setTime(arg0, arg1);
		return this;
	}

	public Query setTime(String arg0, Date arg1) {
		query = query.setTime(arg0, arg1);
		return this;
	}

	public Query setTimeout(int arg0) {
		query = query.setTimeout(arg0);
		return this;
	}

	public Query setTimestamp(int arg0, Date arg1) {
		query = query.setTimestamp(arg0, arg1);
		return this;
	}

	public Query setTimestamp(String arg0, Date arg1) {
		query = query.setTimestamp(arg0, arg1);
		return this;
	}

	public Object uniqueResult() throws HibernateException {
		return query.uniqueResult();
	}

	public int executeUpdate() throws HibernateException {
		throw new HibernateException("cannot update database in this operation.");
	}

	public Query setResultTransformer(ResultTransformer arg0) {
		query.setResultTransformer(arg0);
		return this;
	}

	@SuppressWarnings("unchecked")
	public Query setProperties(Map bean) throws HibernateException {
		// TODO Auto-generated method stub
		return null;
	}

}
